<%
  # initialization code for this partial 
  # user needs to specify :deal, :comment, :comment_pages, :login_action
%>

<div id="answer_list">
  <% for answer in @answers %>
  <div class="answer_content">
    <div class="answer_user">
      
    </div>
    <div class="answer_answer">
      <%= answer.answer %>
    </div>
    <div class="answer_created_at">
      <%= answer.created_at %>
    </div>
  </div>
  <% end %>
</div>

<%= link_to 'Previous answers', { :page => answer_pages.current.previous } if answer_pages.current.previous %>
<%= link_to 'More answers', { :page => answer_pages.current.next } if answer_pages.current.next %> 


<% if session[:user] %>
  <div>Answer it</div>
  <%= start_form_tag :action => 'add_answer' %>
  <%= hidden_field ('question', 'id', "value"=>question.id.to_s) %>
  <p><label for="user_answer">Answer</label><br/>
  <%= text_area 'answer', 'answer'  %></p>
  <%= submit_tag "Answer it !" %>
<%= end_form_tag %>
<% else %>      
  <%= link_to 'Answer it:', :action=>login_action %>
<% end %>      
      